home *** CD-ROM | disk | FTP | other *** search
/ MacFormat 2003 June / macformat-130.iso / mac / Reviewed⁄Demos / Spearhead Demo / demota / pak1.pk3 / global / scientist_standtable.scr < prev    next >
Encoding:
Text File  |  2002-10-21  |  4.7 KB  |  193 lines

  1. start group.sci local.table:
  2.  
  3.     //println "Entered scientist_standtable.scr"
  4.  
  5.  
  6.     if (local.table!= NIL)
  7.     {
  8.         println "Moving scientist to table"
  9.         group.forwardvector = local.table.forwardvector
  10.     
  11.         println group.forwardvector
  12.         group.origin = local.table.origin + (group.forwardvector*16)
  13.     
  14.         thread sciwalkto group.origin
  15.     }
  16.     else
  17.     {
  18.         println "Leaving scientist in place"
  19.         group.origin = group.sci.origin
  20.         group.forwardvector = group.sci.forwardvector * -1
  21.         thread depressed
  22.     }
  23.  
  24. end
  25.  
  26. //-----------inposition-----------
  27. // Moves scientist into the position he needs to be in.  Returns 1 if he is already ok.
  28. inposition:
  29.  
  30.     if ( vector_length(group.sci.origin - group.origin) > 8 )
  31.     {
  32.         println "Moving scientist to table"
  33.         group.donemarker = 0
  34.         thread sciwalkto group.origin
  35.         end 0
  36.     }
  37.     else 
  38.     {
  39.         group.sci.origin = group.origin
  40.         end 1
  41.     }
  42. end    // Not necessary, but easier to read
  43.  
  44.  
  45. //-----------sciwalkto------------
  46. sciwalkto local.pos:
  47. //    thread walklook ( local.pos + (0 0 48) )
  48. //    local.lookthread = parm.previousthread
  49.  
  50.     group.sci exec global/walkto.scr local.pos
  51.     if (level.scienceinterupt != 0)
  52.     end    
  53.     group.sci waittill movedone
  54. //    group.sci turnto (group.sci.origin - group.forwardvector )
  55.     group.sci.origin = local.pos
  56. //    local.lookthread end
  57.     
  58.     thread depressed
  59.  
  60. end
  61.  
  62.  
  63. //------------walklook--------------
  64. walklook local.target:
  65.     while (1)
  66.     {
  67.     // Make him look at the player until that works.  TODO: Make him look at his target
  68.         group.sci lookat $player
  69.         wait 0.5
  70.     }
  71.  
  72. //-----------depressed------------
  73. depressed:
  74.     if(level.scienceinterupt == 0)
  75.     {
  76. //        println "Entered scientist_standtable.scr::depressed"
  77. //         Check position
  78. //        if ( !(thread inposition) ) end
  79. // Look straight ahead and turn to the board
  80. //        group.sci lookat group.sci
  81. //        group.sci turnto (group.sci.origin - group.forwardvector )
  82.         group.sci anim "scientist_standtable_straight"
  83.         if (level.scienceinterupt != 0)
  84.         end    
  85.         local.randnum = (randomint 200) + 300
  86.         wait ( local.randnum / 100 )
  87.  
  88. //     (Turn him back to the table in case something distracted him.)
  89. //        group.sci turnto (group.sci.origin - group.forwardvector )
  90. //        group.sci anim "scientist_standtable_straighttolean"
  91. //        group.sci waittill animdone
  92.         
  93.         local.randnum = randomint (100)    
  94.         if        (local.randnum < 30)    thread idle1
  95.         else if    (local.randnum < 60)    thread idle2
  96.         else if    (local.randnum < 90)    thread idle3
  97.         else                        thread idletodepressed
  98.     }    
  99. end
  100.  
  101. //-----------idle1------------
  102. idle1:
  103.     if(level.scienceinterupt == 0)
  104.     {
  105.         //println "Entered scientist_standtable.scr::idle1"
  106.     
  107.         // Check position
  108. //            if ( !(thread inposition) ) end
  109.         
  110.         group.sci turnto (group.sci.origin - group.forwardvector )
  111.         group.sci anim "scientist_standtable_lean01"
  112.         if (level.scienceinterupt != 0)
  113.         end
  114.         group.sci waittill animdone
  115.         
  116.         local.randnum = randomint (100)
  117.         if        (local.randnum < 10)    thread idle1
  118.         else if    (local.randnum < 50)    thread idle2
  119.         else if    (local.randnum < 90)    thread idle3
  120.         else                        thread idletodepressed
  121.     }
  122. end
  123.  
  124. //-----------idle2------------
  125. idle2:
  126.     if(level.scienceinterupt == 0)
  127.     {    
  128.         //println "Entered scientist_standtable.scr::idle2"
  129.     
  130.         // Check position
  131. //         if ( !(thread inposition) ) end
  132.         
  133.         group.sci turnto (group.sci.origin - group.forwardvector )
  134.  
  135.         group.sci anim "scientist_standtable_lean02"
  136.         if (level.scienceinterupt != 0)
  137.         end    
  138.         group.sci waittill animdone
  139.         
  140.         local.randnum = randomint (100)
  141.         if        (local.randnum < 40)    thread idle1
  142.         else if    (local.randnum < 50)    thread idle2
  143.         else if    (local.randnum < 90)    thread idle3
  144.         else                        thread idletodepressed
  145.     }
  146. end
  147.  
  148. //-----------idle3------------
  149. idle3:
  150.     if(level.scienceinterupt == 0)
  151.     {
  152.         //println "Entered scientist_standtable.scr::idle3"
  153.         
  154.         // Check position
  155. //         if ( !(thread inposition) ) end
  156.         
  157.         group.sci turnto (group.sci.origin - group.forwardvector )
  158.  
  159.         group.sci anim "scientist_standtable_lean03"
  160.         if (level.scienceinterupt != 0)
  161.         end    
  162.         group.sci waittill animdone
  163.  
  164.         local.randnum = randomint (100)
  165.         if        (local.randnum < 35)    thread idle1
  166.         else if    (local.randnum < 70)    thread idle2
  167.         else if    (local.randnum < 80)    thread idle3
  168.         else                        thread idletodepressed
  169.     }
  170. end
  171.  
  172.  
  173. //-----------idletodepressed------------
  174. idletodepressed:
  175.     if(level.scienceinterupt == 0)
  176.     {
  177.         //println "Entered scientist_standtable.scr::idletodepressed"
  178.  
  179.         // Check position
  180. //         ( !(thread inposition) ) end
  181.  
  182.         group.sci turnto (group.sci.origin - group.forwardvector )
  183.         if (level.scienceinterupt != 0) end
  184.         group.sci anim "scientist_standtable_leantostraight"
  185.         if (level.scienceinterupt != 0)
  186.         end
  187.         group.sci waittill animdone
  188.         thread depressed
  189.     }
  190. end
  191.  
  192.  
  193.